﻿using System;
using System.Diagnostics;
using Assist;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace DBService
{
	[Regeneration(RegenerationOption.Manual)]
	[Transaction(TransactionMode.Manual)]
	internal class CmdUserManage : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
		{
			try
			{
				Process[] processesByName = Process.GetProcessesByName("Revit");
				if (processesByName.Length != 0)
				{
					WindowHandle owner = new WindowHandle(processesByName[0].MainWindowHandle);
					new DlgUserManage("SYS").ShowDialog(owner);
				}
			}
			catch
			{
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
